<?php

namespace App\Models;

class SysMenu extends ApiBaseModel
{
    protected $table = 'sys_menu';
    protected $fillable = [
        'menu_name',
        'parent_id',
        'order_num',
        'path',
        'component',
        'query',
        'is_frame',
        'is_cache',
        'menu_type',
        'visible',
        'status',
        'perms',
        'icon',
        'create_by',
        'update_by',
        'remark',
        'created_at',
        'updated_at',
    ];
    protected $casts = [
        'status' => 'string',
        'visible' => 'string',
        'is_frame' => 'string',
        'is_cache' => 'string',

    ];

    public static function getMenuTree(){
        return self::select('id','menu_name as label','parent_id')->get();
    }
}
